<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui">
	<ui:composition template="/templates/padraoJSF.xhtml">
		<ui:define name="barraTitulo">Cadastro de Curso</ui:define>
		<ui:define name="conteudo">
			<!-- COORDENADOR -->
			<p:dialog header="Pesquisa Coordenador" widgetVar="modalPsqCoordenador" modal="true" onCloseUpdate="form" height="480" width="600"  id="boxPesquisarCoordenador">
				<h:form id="formPesquisaCoordenador">
					<p:tabView id="tabView">
						<p:tab title="Pesquisa de Pessoa">
							<fieldset>
								<h:panelGrid columns="2" columnClasses="alinhaEsq width50">
									<h:column>
										<h:outputLabel value="Nome:" styleClass="textfield" />
									</h:column>
									<h:column>
										<h:inputText value="#{controleCurso.pesquisaNomePessoa}"  size="80" styleClass="textfield" />
									</h:column>
								</h:panelGrid>
							</fieldset>
							<p:commandLink action="#{controleCurso.pesquisarPessoa}" styleClass="alinhaDir" update=":listaPesquisaCoordenador">
								<h:graphicImage url="/images/botoes/btnPesquisar.png" class="btnAcoes"/>
							</p:commandLink>
						</p:tab>
					</p:tabView>
				</h:form>
				<br/>
				<br/>
				<h:form id="listaPesquisaCoordenador">
					<p:dataTable value="#{controleCurso.listaPessoa}" 
					             id="id_ListaPessoa"
					             var="pessoa" 
					             paginator="true" 
					             rows="10" 
					             dynamic="true" 
					             rendered="#{not empty controleCurso.listaPessoa}" 
								 firstPageLinkLabel="Primeiro"
					             previousPageLinkLabel="Anterior"
					             nextPageLinkLabel ="Pr&oacute;ximo"
					             lastPageLinkLabel="&Uacute;ltima"
					             emptyMessage="Nenhum resgistro encontrado"
					             errorMessage="Ocorreu um erro"
	    			             selection="#{controleCurso.curso.coordenador}" 
					             selectionMode="single" >
						<p:column>
							<f:facet name="header">
								<h:outputText value="Nome" />
							</f:facet>
							<h:outputText value="#{pessoa.nome}" />
						</p:column>
						<p:column resizable="true" styleClass="width20">
							<f:facet name="header">
								<h:outputText value="A&ccedil;&atilde;o" /> 
							</f:facet>
                            <h:commandLink onclick="modalPsqCoordenador.hide()">
								<p:graphicImage url="/images/marcadores/add.png" alt="Seleciona Coordenador"/>
								<f:setPropertyActionListener target="#{controleCurso.curso.coordenador}" value="#{pessoa}" />
                            </h:commandLink>
                     	</p:column>
					</p:dataTable>
				</h:form>
			</p:dialog>
			<!-- FORM PRINCIPAL -->
			<h:form id="form">
				<p:growl id="messages"/>
				<fieldset>
					<p:tabView>
						<p:tab title="Cadastro">
							<h:panelGrid columns="2" columnClasses="alinhaDir" >
								<h:column >
								</h:column>
								<h:column >
									<h:outputText value="Os campos com asterisco (*) s&atilde;o de preenchimento obrigat&oacute;rio." styleClass="campoObrigatorio" />
								</h:column>
								<h:outputLabel value="Identificador:" styleClass="select" />
								<h:column >
									<h:inputText type="text" class="textfield" id="identificador" size="6" maxlength="6" value="#{controleCurso.curso.identificador}" requiredMessage="Campo [IDENTIFICADOR] obrigat&oacute;rio" required="true" alt=""/>
									<h:outputText value="(*)" styleClass="campoObrigatorio" />
								</h:column>
								<h:outputLabel value="Faculdade:" styleClass="select" />
								<h:column >
									<h:selectOneMenu value="#{controleCurso.curso.faculdade}" id="faculdade">
										<f:converter converterId="converteFaculdade"/>
										<f:selectItem itemLabel="selecione" itemValue="#{controleCurso.faculdadeSelecione}"/>
					                    <f:selectItems value="#{controleCurso.listaFaculdade}" var="faculdade" itemLabel="#{faculdade.descricao}" itemValue="#{faculdade}"/>
									</h:selectOneMenu>
									<h:outputText value="(*)" styleClass="campoObrigatorio" />
								</h:column>
								<h:outputLabel value="Unidade:" styleClass="select" />
								<h:column >
									<h:selectOneMenu value="#{controleCurso.curso.unidade}" id="unidade">
										<f:converter converterId="converteUnidade"/>
										<f:selectItem itemLabel="selecione" itemValue="#{controleCurso.unidadeSelecione}"/>
					                    <f:selectItems value="#{controleCurso.listaUnidade}" var="unidade" itemLabel="#{unidade.descricao}" itemValue="#{unidade}"/>
									</h:selectOneMenu>
									<h:outputText value="(*)" styleClass="campoObrigatorio" />
								</h:column>
								<h:outputLabel value="Descri&ccedil;&atilde;o:" styleClass="select" />
								<h:column >
									<h:inputText type="text" class="textfield" id="descricao" size="50" maxlength="50" value="#{controleCurso.curso.descricao}" requiredMessage="Campo [DESCRI&Ccedil;&Atilde;O] obrigat&oacute;rio" required="true" alt=""/>
									<h:outputText value="(*)" styleClass="campoObrigatorio" />
								</h:column>
								<h:outputLabel value="Data de Cria&ccedil;&atilde;o:" styleClass="select" />
								<h:column >
									<h:panelGrid columns="11" columnClasses="width160, width15, width50, width50, width15, width10, width20, width15, width20, width15">
										<p:calendar value="#{controleCurso.curso.dataCriacao}" title="Choose a Date" pattern="dd/MM/yyyy"/>
										<h:outputText value="(*)" styleClass="campoObrigatorio" />
										<h:outputLabel value="Per&iacute;odos:" styleClass="select" />
										<h:selectOneMenu value="#{controleCurso.curso.periodos}" id="periodo">
						                    <f:selectItems value="#{controleCurso.listaPeriodos}" var="periodo" itemLabel="#{periodo.label}" itemValue="#{periodo.value}"/>
										</h:selectOneMenu>
										<h:outputText value="(*)" styleClass="campoObrigatorio" />
										<h:outputLabel value="Turno:" styleClass="select" />
										<h:selectOneMenu value="#{controleCurso.curso.turno}" id="turno">
											<f:selectItem itemLabel="selecione" itemValue=""/>
						                    <f:selectItems value="#{controleCurso.listaTurno}" var="turno" itemLabel="#{turno}" itemValue="#{turno}"/>
										</h:selectOneMenu>
										<h:outputText value="(*)" styleClass="campoObrigatorio" />
									</h:panelGrid>
								</h:column>
								<h:outputLabel value="E-mail:" styleClass="select" />
								<h:column >
									<h:inputText type="text" class="textfield" id="email" size="100" maxlength="100" value="#{controleCurso.curso.email}" requiredMessage="Campo [E-MAIL] obrigat&oacute;rio" required="true" alt=""/>
									<h:outputText value="(*)" styleClass="campoObrigatorio" />
								</h:column>
								<h:outputLabel value="Autoriza&ccedil;&atilde;o:" styleClass="select" />
								<h:column >
									<h:inputText type="text" class="textfield" id="autorizacao" size="100" maxlength="100" value="#{controleCurso.curso.autorizacao}" requiredMessage="Campo [AUTORIZA&Ccedil;&Atilde;O] obrigat&oacute;rio" required="true" alt=""/>
									<h:outputText value="(*)" styleClass="campoObrigatorio" />
								</h:column>
								<h:outputLabel value="Portaria:" styleClass="select" />
								<h:column >
									<h:inputText type="text" class="textfield" id="portaria" size="100" maxlength="100" value="#{controleCurso.curso.portaria}" requiredMessage="Campo [PORTARIA] obrigat&oacute;rio" required="true" alt=""/>
									<h:outputText value="(*)" styleClass="campoObrigatorio" />
								</h:column>
								<h:outputLabel value="Reconhecimento:" styleClass="select" />
								<h:column >
									<h:inputText type="text" class="textfield" id="reconhecimento" size="100" maxlength="100" value="#{controleCurso.curso.reconhecimento}" requiredMessage="Campo [RECONHECIMENTO] obrigat&oacute;rio" required="true" alt=""/>
									<h:outputText value="(*)" styleClass="campoObrigatorio" />
								</h:column>
								<h:outputLabel value="Coordenador:" styleClass="select" />
								<h:column >
									<h:column>
										<h:outputText value="#{controleCurso.curso.coordenador.nome}" id="viceDiretor"/>
									</h:column>
									<p:commandLink oncomplete="modalPsqCoordenador.show();"  >
										<h:graphicImage url="/images/botoes/btnSelecionar.png" styleClass="iconesLaterais" />
									</p:commandLink>
								</h:column>
								<h:outputLabel value="C.Custo:" styleClass="select" />
								<h:column >
									<h:inputText type="text" class="textfield" id="centroCusto" size="20" maxlength="20" value="#{controleCurso.curso.centroCusto}" requiredMessage="Campo [CENTRO CUSTO] obrigat&oacute;rio" required="true" alt=""/>
									<h:outputText value="(*)" styleClass="campoObrigatorio" />
								</h:column>
								<h:column>
									<h:outputLabel value="Conta Banc&aacute;ria:" />
								</h:column>
								<h:column>
									<h:selectOneMenu value="#{controleCurso.curso.contasBanco}" requiredMessage="Campo [CONTA BANC&Aacute;RIA] obrigat&oacute;rio" required="true">
										<f:selectItem itemLabel="selecione" itemValue="#{controleCurso.contasBancoSelecione}"/>
					                    <f:selectItems value="#{controleCurso.contasBancos}" var="contasBanco" itemLabel="#{contasBanco.descricao}" itemValue="#{contasBanco}" />
					                    <f:converter converterId="converteContasBanco" />
									</h:selectOneMenu>
									<h:outputText value="(*)" styleClass="campoObrigatorio" />&nbsp;
								</h:column>
							</h:panelGrid>
						</p:tab>
					</p:tabView>
				</fieldset>
				<h:outputLink value="manutencao.jsf">
					<h:graphicImage url="/images/botoes/btnPesquisar.png" class="btnAcoes" />
				</h:outputLink>
				<h:commandLink action="#{controleCurso.gravar}" styleClass="alinhaDir">
					<h:graphicImage url="/images/botoes/btnGravar.png" class="btnAcoes"/>
				</h:commandLink>
			</h:form>
		</ui:define>
	</ui:composition>
</html>